import { ElMessage, ElMessageBox } from 'element-plus'
export default {
    install(Vue) {
        Vue.config.globalProperties.confirm = (params) => {
            ElMessageBox.confirm(
                params.content,
                params.tip || "提示",
                {
                    confirmButtonText: "确定",
                    cancelButtonText: "取消",
                    type: params.type || "warning",
                    center: true,
                }
            )
                .then(() => {
                    params.successFn && params.successFn();
                })
                .catch(() => {
                    params.cancelFn && params.cancelFn();
                    ElMessage({
                        type: "info",
                        message: "已取消删除",
                    });
                });
        }
    }
}